<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    body {
      /* 弹性容器 */
      display: flex;
    }

    div {
      width: 100px;
      height: 100px;
    }

    div:nth-child(1) {
      background-color: red;
    }

    div:nth-child(2) {
      background-color: orange;
    }

    div:nth-child(3) {
      background-color: yellow;
    }

    div:nth-child(4) {
      background-color: green;
    }

    div:nth-child(5) {
      background-color: cyan;
    }

    div:nth-child(6) {
      background-color: blue;
    }

    div:nth-child(7) {
      background-color: purple;
    }
  </style>
</head>

<body>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
</body>

</html>